using System;
using Headspring.Training.Core.Model;
using Headspring.Training.Core.Services;
using Headspring.Training.Core.Services.Impl;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;

namespace Headspring.Training.UnitTests.Services
{
	[TestFixture]
	public class EmailServiceTester
	{
		public class SessionStub : IUserSession
		{
			public FlashMessage FlashMessage;

			public Employee GetCurrentUser()
			{
				throw new NotImplementedException();
			}

			public void LogIn(Employee employee)
			{
				throw new NotImplementedException();
			}

			public void LogOut()
			{
				throw new NotImplementedException();
			}

			public void PushUserMessage(FlashMessage message)
			{
				FlashMessage = message;
			}

			public FlashMessage PopUserMessage()
			{
				throw new NotImplementedException();
			}
		}

		[Test]
		public void ShouldSendPopMessage()
		{
			var userSession = new SessionStub();

			IEmailService service = new EmailService(userSession);
			service.SendMessage("bleh", "that's cool");

			Assert.That(userSession.FlashMessage.Message,
			            Is.EqualTo("'that's cool' email sent to 'bleh'"));
		}
	}
}